home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12611 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: risky.ecs.umass.edu!usenet
  2. From: jvinson@cheux.ecs.umass.edu (Jack Vinson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: template instantiation (was passing references to containers?)
  5. Date: 20 Mar 1996 16:06:50 -0500
  6. Organization: University of Massachusetts
  7. Message-ID: <wo3f735v9x.fsf@cheux.ecs.umass.edu>
  8. References: <wozq9lc29c.fsf@cheux.ecs.umass.edu>
  9.     <wopwaglpjo.fsf_-_@cheux.ecs.umass.edu>
  10.     <Pine.LNX.3.91.960319132516.9204A-100000@applink>
  11. NNTP-Posting-Host: cheux.ecs.umass.edu
  12. To: Brian Haskett <haskett@applink.net>
  13. X-Newsreader: September Gnus v0.54/Emacs 19.30
  14.  
  15. >>>>> "BH" == Brian Haskett <haskett@applink.net> writes:
  16.  
  17. BH> On 13 Mar 1996, Jack Vinson wrote:
  18.  
  19. >> From reading this group, it appears that the solutions is to add a dummy
  20. >> function to each file (or to a common .h file) with variables of the
  21. >> appropriate types.
  22. >> 
  23. >> void foo()
  24. >> {
  25. >> array<class1> c1;
  26. >> array<class2> c2;
  27. >> }
  28.  
  29. BH> I don't like the looks of this solution.  Unless I am mistaken, it appears
  30. BH> that every object file created based on the header file that contains
  31. BH> foo() will have the definition of foo() in it?  So on a large project like
  32. BH> what I am working on, with hundreds of object files, foo() will be defined
  33. BH> in all of them?  Not to mention the added information necessary to
  34. BH> instantiate that template for every object file, needed or not. 
  35.  
  36. I don't either.  What I've done in my large project is simply create a
  37. filename_junk() function which does the same thing as foo() above.  This
  38. way, at least, there won't be a zillion versions of foo() sitting around.
  39. In addition, I only add templates for those variables I will need in that
  40. particular object file.
  41.  
  42. -- 
  43. Jack Vinson                       jvinson@cheux.ecs.umass.edu
  44. "I wish I were spatial, but I'm a plane." - Radiohead (sorta)
  45.